<?php
/**
 * All data collected by the wizard and stored in the HTTP session.
 */
class RegistrationWizardData {

    public static $STEP_PERSONAL_DATA = 'personalData';
    public static $STEP_PROGRAM = 'program';
    public static $STEP_PROGRAM_SPECIFIC = 'programSpecific';
    public static $STEP_PRICE = 'price';
    public static $STEP_PAYMENT = 'payment';
    public static $STEP_SUMMARY = 'summary';

    public static $STEPS; // Initialized below the class declaration

    public $step;

    // Seminar
    public $seminar;
    public $priceGroup;
    public $isAfterDeadline;

    // Programs
    public $selectedProgramList = array();

    // Program specifics
    public $appliesForStandardProgram = false;
    public $appliesForKarmayoga = false;
    public $programNotes;
    public $exerciseGroup;
    public $karmayogaType;
    
    // Price
    public $isSocialDiscountApplied = FALSE; /* boolean */
    public $socialDiscount;
    public $isEarlyDiscountApplied = FALSE;
    public $isLateChargeApplied = FALSE;
    public $earlyDiscount;
    public $preliminaryPrice; /* Total price without payment fees - we need to be able to recalculate total price if a user makes a step back in the wizard. */
    public $totalPrice;
    public $extraDiscountForm;

    // Payment
    public $paymentForm;
    public $paymentCountry;
    public $paymentOrganization;
    public $paymentType;
    public $paymentNotes;
    public $paymentOnArrivalFee;

    public $registrationIdList;

    public function __construct() {
        $this->step = self::$STEPS[0];
    }

    public function goBackToStep($step) {
        $this->step = $step;
        switch ($step) {
            case self::$STEP_PROGRAM :
                //$this->programNotes = null;
                $this->exerciseGroup = null;
                $this->karmayogaType = null;
                $this->appliesForStandardProgram = false;
                $this->appliesForKarmayoga = false;
            case self::$STEP_PROGRAM_SPECIFIC :
                $this->isSocialDiscountApplied = FALSE;
                $this->socialDiscount = null;
                $this->isEarlyDiscountApplied = FALSE;
                $this->earlyDiscount = null;
                $this->extraDiscountForm = null;
            case self::$STEP_PRICE :
                // $this->paymentForm = null;
                // $this->paymentCountry = null;
                // $this->paymentOrganization = null;
                // $this->paymentType = null;
                // $this->paymentNotes = null;
            case self::$STEP_PAYMENT :
            default :
                break;
        }

    }
}

// This array sets the order of the wizard steps
RegistrationWizardData::$STEPS = array(
        RegistrationWizardData::$STEP_PERSONAL_DATA,
        RegistrationWizardData::$STEP_PROGRAM,
        RegistrationWizardData::$STEP_PROGRAM_SPECIFIC,
        RegistrationWizardData::$STEP_PRICE,
        RegistrationWizardData::$STEP_PAYMENT,
        RegistrationWizardData::$STEP_SUMMARY
);


